<template>
 <div class="layoutCenter">
    <portal-layout-preview ></portal-layout-preview>
  </div>
</template>
<script>
  import PortalLayoutPreview from '@/views/modules/portal/core/PortalLayoutPreview';

  import { mapState} from "vuex";
  import router from '@/router';
  export default {
    name: 'index',
    computed: {
      ...mapState({
        menus: state => state.appSetting.menus,
        appKey: state => state.appSetting.appKey,
        activeKey: state => state.appSetting.activeKey,
        menuMap: state => state.appSetting.menuMap,
      })
    },
    components: {
        "portal-layout-preview": PortalLayoutPreview,
    },
    created() {
      if(this.activeKey!='home-index'){
        var appKey=this.appKey;
        for(var i=0;i<this.menus.length;i++){
          var menu=this.menus[i];
          if(menu.component && appKey==menu.key){
            var pathParams = {name: menu.key};
            router.push(pathParams);
            return;
          }
        }
      }
    },

  }
</script>
<style scoped>
.layoutCenter{
    height: 100%;
}
</style>

